package com.lhn;

import com.lhn.dao.BookDao;
import com.lhn.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author lhn
 * @date 2024-08-19 13:00
 */

public class App10 {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        System.out.println("bookDao is " + bookDao);

        //bookService中的@Component没有配置id
        BookService bookService = ctx.getBean(BookService.class);
        System.out.println("bookService is " + bookService);
    }
}
